package com.ucampus.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 功能：
 * 作者： 启明星_Polaris
 * 日期：2025/1/7 下午8:53
 **/

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    private JwtInterceptor jwtInterpreter;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册拦截器
        registry.addInterceptor(jwtInterpreter)
                .addPathPatterns("/**") // 对所有路径进行拦截
                .excludePathPatterns("/article/**","/article/delete","/shop/*", "/building/*","/manager/*","/user/*","/register/*",
                "/users/","/users/select","/users/updatestatus","/users/deleteuser","/login/**","/status/**"); // 排除不需要Token验证的路径
    }
}
